#!/bin/bash

if [ $# -eq 0 ]; then
    ps aux 
    num=$(ps aux |wc -l)
else
    ps aux |grep --color=always $1 |egrep -v 'grep ' |grep -v 'sg-ps '
    num=$(ps aux |grep $1 |egrep -v 'grep ' | grep -v 'sg-ps ' |wc -l)
fi

echo 
echo "result total: $num"
